<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding:0;
        }
        body {
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
        }
        .box {
            display: flex;
            justify-content: space-between;
            min-width: 80px;
        }
        ul {
            display: flex;
            list-style: none;
        }
        ul li {
            padding: 0 5px;
            margin: 0 2px;
            cursor: pointer;
        }
    </style>
</head>
<body>
    <div class="box">
        <button onclick="prew()">&lt;</button>
        <ul>
            <li onclick="">1</li>
            <li onclick="">1</li>
        </ul>
        <button onclick="next()">&gt;</button>
    </div>
</body>
<script>
    let dataList = [{
        name: '张三',
        age: '24',
        sex: '男'
    },{
        name: '李四',
        age: '25',
        sex: '男'
    },{
        name: '王五',
        age: '24',
        sex: '女'
    },{
        name: '赵六',
        age: '25',
        sex: '男'
    },{
        name: '刘大',
        age: '23',
        sex: '男'
    },{
        name: '孔二',
        age: '27',
        sex: '女'
    },{
        name: '张三',
        age: '24',
        sex: '男'
    },{
        name: '李四',
        age: '25',
        sex: '男'
    },{
        name: '王五',
        age: '24',
        sex: '女'
    },{
        name: '赵六',
        age: '25',
        sex: '男'
    },{
        name: '刘大',
        age: '23',
        sex: '男'
    },{
        name: '孔二',
        age: '27',
        sex: '女'
    },{
        name: '张三',
        age: '24',
        sex: '男'
    },{
        name: '李四',
        age: '25',
        sex: '男'
    },{
        name: '王五',
        age: '24',
        sex: '女'
    },{
        name: '赵六',
        age: '25',
        sex: '男'
    },{
        name: '刘大',
        age: '23',
        sex: '男'
    },{
        name: '孔二',
        age: '27',
        sex: '女'
    },{
        name: '张三',
        age: '24',
        sex: '男'
    },{
        name: '李四',
        age: '25',
        sex: '男'
    },{
        name: '王五',
        age: '24',
        sex: '女'
    },{
        name: '赵六',
        age: '25',
        sex: '男'
    },{
        name: '刘大',
        age: '23',
        sex: '男'
    },{
        name: '孔二',
        age: '27',
        sex: '女'
    },{
        name: '张三',
        age: '24',
        sex: '男'
    },{
        name: '李四',
        age: '25',
        sex: '男'
    },{
        name: '王五',
        age: '24',
        sex: '女'
    },{
        name: '赵六',
        age: '25',
        sex: '男'
    },{
        name: '刘大',
        age: '23',
        sex: '男'
    },{
        name: '孔二',
        age: '27',
        sex: '女'
    },{
        name: '张三',
        age: '24',
        sex: '男'
    },{
        name: '李四',
        age: '25',
        sex: '男'
    },{
        name: '王五',
        age: '24',
        sex: '女'
    },{
        name: '赵六',
        age: '25',
        sex: '男'
    },{
        name: '刘大',
        age: '23',
        sex: '男'
    },{
        name: '孔二',
        age: '27',
        sex: '女'
    },{
        name: '张三',
        age: '24',
        sex: '男'
    },{
        name: '李四',
        age: '25',
        sex: '男'
    },{
        name: '王五',
        age: '24',
        sex: '女'
    },{
        name: '赵六',
        age: '25',
        sex: '男'
    },{
        name: '刘大',
        age: '23',
        sex: '男'
    },{
        name: '孔二',
        age: '27',
        sex: '女'
    },{
        name: '张三',
        age: '24',
        sex: '男'
    },{
        name: '李四',
        age: '25',
        sex: '男'
    },{
        name: '王五',
        age: '24',
        sex: '女'
    },{
        name: '赵六',
        age: '25',
        sex: '男'
    },{
        name: '刘大',
        age: '23',
        sex: '男'
    },{
        name: '孔二',
        age: '27',
        sex: '女'
    },{
        name: '张三',
        age: '24',
        sex: '男'
    },{
        name: '李四',
        age: '25',
        sex: '男'
    },{
        name: '王五',
        age: '24',
        sex: '女'
    },{
        name: '赵六',
        age: '25',
        sex: '男'
    },{
        name: '刘大',
        age: '23',
        sex: '男'
    },{
        name: '孔二',
        age: '27',
        sex: '女'
    },{
        name: '张三',
        age: '24',
        sex: '男'
    },{
        name: '李四',
        age: '25',
        sex: '男'
    },{
        name: '王五',
        age: '24',
        sex: '女'
    },{
        name: '赵六',
        age: '25',
        sex: '男'
    },{
        name: '刘大',
        age: '23',
        sex: '男'
    },{
        name: '孔二',
        age: '27',
        sex: '女'
    }]
    
    // 上一页功能
    function prew () {
        console.log('上一页')
    }
    
    // 下一页功能
    function next () {
        console.log('下一页')
    }


    // 分页函数 传三个参数 当前页、每页数量、数据数组
    function pagination (number,pageSize,data) {
        pageData = []
        // 设置开始
        let start = (pageSize * number) - pageSize
        // 设置结束长度
        let end = pageSize * number
        end = end > data.length ? data.length : end
        for(let i = start; i < end; i++) {
            pageData.push(data[i])
        }
        console.log('分页后的数据',pageData)
    }
    
    console.log(dataList.length)
</script>
</html>